var XSST = function (ID) {

  if(typeof(ID) == 'undefined') {
    ID = 'xssobjcs_2009_'+Math.floor(Math.random()*1000000);
  }
  this.ID = ID;
  
  this._after = function (D) { alert(D); };
  this._except = function (E) { /*...*/ };
  
  this.getdata = function () {
    if(document.getElementById(this.ID).src != 'about:blank') {
      setTimeout('document.getElementById(\''+this.ID+'\')._this.getdata();',200);
    }
    if(typeof(console) != 'undefined') { console.warn('this.getdata'); }
    document.getElementById(this.ID).onload = function () {};
    var v = document.getElementById(this.ID).contentWindow.name;
    try {
      eval('v = ' + v + ';');
    }
    catch(E) {
      this._except(E);
    }
    this.removeifnode();
    this._after(v);
  };
  
  this.after = function (F) { this._after = F; return this; };
 
  this.onload = function () {
    if(typeof(console) != 'undefined') { console.warn('this.onload'); }
    this.onload = this.getdata;
    this.src = 'about:blank';
    setTimeout('document.getElementById(\''+this.id+'\')._this.getdata();',200);
  };
  
  this.get = function (url,prms) {
    var s = document.createElement('IFRAME');
    s.onload = this.onload;
    s.id = this.ID;
    s.src = url + this._getform(url,prms);
    s._this = this;
    s.style.display = 'none';
    document.getElementsByTagName('HTML')[0].appendChild(s);
  };
  
  this.removeifnode = function () {
    document.getElementById(this.ID).parentNode.removeChild(document.getElementById(this.ID));
  };
  
  this.post = function (url,prms) {
    var s = document.createElement('IFRAME');
    s.id = this.ID;
    s._this = this;
    s.style.display = 'none';
    document.getElementsByTagName('HTML')[0].appendChild(s);
    s.contentDocument.open();
    var _html = '<form action="'+url+'" method="POST" target="_self">';
    for (all in prms) {
      _html += '<input type="hidden" name="' + all.toString() + '" value="' + prms[all].toString().replace('"','\"') + '"/>';
    };
    _html += '</form>';
    s.contentDocument.write(_html);
    s.contentDocument.close();
    setTimeout('document.getElementById(\''+this.ID+'\').onload = document.getElementById(\''+this.ID+'\')._this.onload; document.getElementById(\''+this.ID+'\').contentDocument.forms[0].submit();',200);
  };
  
  this._getform = function (U,P) {
    _uri = '';
    _ = U.split('?');
    if(_.length < 2) {
      _uri += '?';
    }
    for (all in P) {
      _uri += '&' + all + '=' + encodeURIComponent(P[all].toString());
    }
    return _uri;
  };
};
